//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Main.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
typedef char* TBeaRLibMap;
typedef _stdcall TBeaRLibMap (*TGenMap)(int, int, int, char**, int);
TGenMap GenMap;
TBeaRLibMap test;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
  : TForm(Owner)
{



}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormShow(TObject *Sender)
{
  HMODULE hBearLib = LoadLibrary("BeaRLibMG.dll");

  GenMap = (TGenMap)GetProcAddress(hBearLib, "GenMap");

  int width = 300;
  int height = 300;

  test = new char[width*height];

  for (int i = 0; i < width*height; i++)
  {
    test[i] = 0;
  }

  for (int id = 1; id < 16; id++)
  {

    GenMap(width, height, id, &test, width*height);

    AnsiString Line;

    Memo1->Lines->Add(id);

    for (int y = 0; y < height; y++)
    {
      for (int x = 0; x < width; x++)
      {
        Line = Line + test[x + y*width];
      }
      Memo1->Lines->Add(Line);
      Line = "";
    }
  }
  delete[] test;
}
//---------------------------------------------------------------------------
